/********************************************************/
/*	Terrain class by George Chew						*/
/*	For use in GeorgeLib								*/
/*	Created Apr 2013									*/
/*														*/
/*	Version 0001										*/
/********************************************************/

#ifndef __TERRAIN_H__
#define __TERRAIN_H__

#include "stdafx.h"
#include "Logger.h"
#include <fstream>
#include "vec3.h"
#include "Texture.h"

#define MAP_MAX_HEIGHT 30.0f

namespace GeorgeLib
{

	class DLLEXPORT Terrain
	{

		/*		How to use this class 		*/
		// Terrain blank;

	private:
		int size; // size of the heightmap
		GLubyte * heightmap;	// heightmap image data
		float ** heightcollide;	// heightmap collision data

	public:
		vec3 pos; // position of the heightmap

		Terrain(void);			// Constructor
		~Terrain(void);			// Destructor

		// Get the size of the height map
		// If heightmap is not loaded, function will return 0
		int			getSize(void);

		// Free up the memory used by the heightmap
		void		drop(void);

		// Load a .raw image
		bool		LoadRAW(char * filename);

		// Bind a position vector to the height(y-axis) of the map at the current position
		void		BindY(vec3 & pos, float y_offset = 0);

		void		draw(Texture texture);
		void		draw(MultiTexture texture);
	};

} // namespace GeorgeLib

#endif // __TERRAIN_H__ //